namespace Digitalmes.Domain.Sys;

/// <summary>
/// 通知模块
/// </summary>
[SugarTable("sys_notice", "通知模块")]
public class SysNotice : EntityTenantBase
{
    /// <summary>
    /// 发送人编号
    /// </summary>
    [SugarColumn(ColumnDescription = "发送人编号")]
    public long SendUserId { get; set; }

    /// <summary>
    /// 发送人信息
    /// </summary>
    [NotNull]
    [Navigate(NavigateType.OneToOne, nameof(SendUserId))]
    public SysAdmin? SendUser { get; set; }

    /// <summary>
    /// 接收人编号(0=全员)
    /// </summary>
    [SugarColumn(ColumnDescription = "接收人编号(0=全员)", Length = 2048)]
    public List<long> AcceptUserIds { get; set; } = new();

    /// <summary>
    /// 通知标题
    /// </summary>
    [NotNull]
    [SugarColumn(ColumnDescription = "通知标题", Length = 255)]
    public string? Title { get; set; }

    /// <summary>
    /// 通知内容
    /// </summary>
    [SugarColumn(ColumnDescription = "通知内容", Length = 2048)]
    public string? Content { get; set; }

    /// <summary>
    /// 附件内容集合
    /// </summary>
    [SugarColumn(ColumnDescription = "附件内容", IsJson = true, Length = 1024)]
    public List<SysNoticeFiles> Files { get; set; } = new();

    /// <summary>
    /// 1=草稿2=存档3=删除
    /// </summary>
    [SugarColumn(ColumnDescription = "1=草稿2=存档3=删除")]
    public int Status { get; set; }

    /// <summary>
    /// 是否为发送邮件
    /// </summary>
    [SugarColumn(ColumnDescription = "是否为发送邮件")]
    public bool IsSend { get; set; }

    /// <summary>
    /// 通知文件
    /// </summary>
    public sealed class SysNoticeFiles
    {
        /// <summary>
        /// 文件名称
        /// </summary>
        public string? Name { get; set; }

        /// <summary>
        /// 文件地址
        /// </summary>
        public string? Url { get; set; }
    }
}
